{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "varying-cathedral",
   "metadata": {},
   "source": [
    "# Email Notification\n",
    "Sends an email notification\n",
    "\n",
    "Note: This operator is currently nun-funcional.   \n",
    "\n",
    "Todos  \n",
    "\n",
    "[ ] add blessing file read and condition functionality  \n",
    "[ ] add email send attachement functionality (to send blessing outcome as attachment)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "unknown-violation",
   "metadata": {},
   "outputs": [],
   "source": [
    "import smtplib\n",
    "import ssl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "headed-valentine",
   "metadata": {},
   "outputs": [],
   "source": [
    "# @dependency codait_utils.ipynb\n",
    "# @dependency metadata\n",
    "# @dependancy blessing_outcome\n",
    "# (file containing TRUE or FALSE in the first line)\n",
    "# @param blessing_filename"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "satisfactory-bruce",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "port = os.environ.get('port', 465)\n",
    "password = os.environ.get('password')\n",
    "server = os.environ.get('server', 'smtp.gmail.com')\n",
    "user = os.environ.get('user')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "recognized-kingston",
   "metadata": {},
   "outputs": [],
   "source": [
    "skip = True  # component not yet implemented completely\n",
    "\n",
    "if not skip:\n",
    "\n",
    "    port = 465  # For SSL\n",
    "    password = input(\"Type your password and press enter: \")\n",
    "\n",
    "    # Create a secure SSL context\n",
    "    context = ssl.create_default_context()\n",
    "\n",
    "    sender_email, receiver_email, message = ('dummy', 'dummy', 'dummy')\n",
    "\n",
    "    with smtplib.SMTP_SSL(server, port, context=context) as server:\n",
    "        server.login(user, password)\n",
    "        server.sendmail(sender_email, receiver_email, message)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
